<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport"
			content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
		<link rel="stylesheet" href="../../../../layuiadmin/layui/css/layui.css" media="all">
		<link rel="stylesheet" href="../../../../layuiadmin/style/admin.css" media="all">
		<link rel="stylesheet" href="../../../../css/common.css" media="all">
		<style>
			.layui-form-label{
				width: 100px;
			}
			.layui-form-item{
				display: flex;
			}
			.layui-input-block{
				width: 80%;
				margin-left: 0px;
			}
			.test_edit .layui-input-block{
				margin-left: 0px;
			}
		</style>

	</head>

	<body>

		<div class="layui-fluid">
			<div class="layui-row" id="view">
				<form class="layui-form test_edit" lay-filter="test_detail">
					<div class="layui-card">
						<div class="layui-card-body">
							<div class="layui-card">
								<div class="layui-card-body">
									<div class="layui-form-item">
										<label class="layui-form-label">状态：</label>
										<div class="layui-input-block">
											<input type="radio" disabled name="status" value="-1" title="拒绝">
											<!--<input type="radio" name="status" value="0" title="待审核">-->
											<input type="radio" disabled name="status" value="1" title="通过" checked="">
										</div>
									</div>
								</div>
							</div>
                            <div class="layui-card">
								<div class="layui-card-body">
									<div class="layui-form-item">
										<label class="layui-form-label">结算方式：</label>
										<div class="layui-input-block">
											<input type="radio" name="ctype" value="0" title="平台结算" checked />
											<input type="radio" name="ctype" value="1" title="三方结算" />
										</div>
									</div>
								</div>
							</div>
							<div style="display: flex;">
								<div class="layui-form-item">
									<label class="layui-form-label">姓名：</label>
									<div class="layui-input-block">
										<input type="text" name="name" placeholder="请输入姓名" autocomplete="off"
											class="layui-input">
									</div>
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label">性别：</label>
									<div class="layui-input-block sex"></div>
								</div>
							</div>
							<div class="layui-form-item upvideo">
								<label class="layui-form-label">营业执照</label>
								<div class="layui-input-block">
									<button type="button" class="layui-btn layui-btn-normal"
										onclick="choose(1)">上传文件</button>
									<blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
										<ul class="show_img_ul" id="license_pic"></ul>
									</blockquote>
								</div>
							</div>
							<div class="layui-form-item">								<label class="layui-form-label">签名</label>								<div class="layui-input-block">									<img style="width: 50%;height: 150px;" class="layui-upload-img" id="ID-upload-sign-img">								</div>							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">店铺名称：</label>
								<div class="layui-input-block">
									<input type="text" name="reg_name" placeholder="请输入店铺名称" autocomplete="off"
										class="layui-input">
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">营业执照编号</label>
								<div class="layui-input-block">
									<input type="text"  name="license_code" placeholder="请输入营业执照编号" autocomplete="off" class="layui-input">
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">证照有效期</label>
								<div class="layui-input-block">
								    <input type="checkbox" value="1" id="license_validity_type" name="license_validity_type" title="长期" >
								</div>
							</div>
							<div class="layui-form-item">
								<div class="layui-inline">
									<label class="layui-form-label">日期范围</label>
									<div class="layui-inline" id="test-range">
										<div class="layui-input-inline">
											<input type="text" id="startdate" name="startdate" class="layui-input" placeholder="开始日期">
										</div>
										<div class="layui-form-mid">-</div>
										<div class="layui-input-inline">
											<input type="text" id="enddate" name="enddate" class="layui-input" placeholder="结束日期">
										</div>
									</div>
								</div>
							</div>
							
							<div class="layui-form-item">
							    <label class="layui-form-label" >店铺头像</label>
							    <div class="layui-input-block" style="width: 132px;">
									<button type="button" class="layui-btn" id="ID-upload-headimg-btn">
									  <i class="layui-icon layui-icon-upload"></i> 上传图片
									</button>
									<div class="layui-upload-list">
										<img req class="layui-upload-img" id="ID-upload-headimg-img" style="width: 100%; height: 92px;">
										<div id="ID-upload-headimg-text"></div>
									</div>
							    </div>
							</div>
							<div class="layui-form-item">
							 	<label class="layui-form-label">店铺简介：</label>
							 	<div class="layui-input-block">
							 		<input type="text" name="content" placeholder="请输入店铺简介" autocomplete="off"
							 			class="layui-input">
							 	</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">店铺类型</label>
								<div class="layui-input-block">
									<select name="ent_type" lay-filter="aihao">
										<option value=""></option>
										<option value="3">私营企业</option>
										<option value="5">个体工商户</option>
									</select>
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">店铺分类</label>
								<div class="layui-input-block" id="category">
									<!-- <select name="ent_type" lay-filter="aihao">
										<option value=""></option>
										<option value="3">私营企业</option>
										<option value="5">个体工商户</option>
									</select> -->
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">店铺位置：</label>
								<div class="layui-input-block">
									<div id="map-container" style="height: 500px; border: 1px solid #d6ccd6;"></div>
								</div>
							</div>
							<div class="layui-form-item layui-form-text">
							    <label class="layui-form-label">具体位置</label>
							    <div class="layui-input-block">
							      <textarea placeholder="请输入具体位置" name="reg_detail" class="layui-textarea"></textarea>
							    </div>
							</div>
							<!-- <div class="layui-form-item">
								<label class="layui-form-label">经营区域：</label>
								<div class="layui-input-block">
									<input type="text" name="area" placeholder="请输入经营区域" autocomplete="off"
										class="layui-input">
								</div>
							</div> -->
                            <div class="layui-form-item">
								<label class="layui-form-label">商户经营地区</label>
								<div class="layui-input-block">
								    <div class="layui-input-inline addr_inline">
								         <select name="prov_province_code" id="prov_province" lay-filter="prov_province" >
								         </select>
								    </div>
								    <div class="layui-input-inline addr_inline">
								         <select name="prov_city_code" id="prov_city" lay-filter="prov_city" >
								         </select>
								    </div>
								    <div class="layui-input-inline addr_inline" style="margin-right: 0;">
								         <select name="prov_district_code" id="prov_area" lay-filter="prov_area">
								         </select>
								    </div>
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">法人信息</label>
								<div style="display: flex;">
									<div style="margin-right: 60px;">
										<label class="">法人身份证人像面</label>
										<div class="layui-input-block" style="width: 132px;">
											<button type="button" class="layui-btn" id="ID-upload-legal-btn">
											  <i class="layui-icon layui-icon-upload"></i> 上传图片
											</button>
											<div class="layui-upload-list">
												<img class="layui-upload-img" id="ID-upload-legal-img" style="width: 100%; height: 92px;">
												<div id="ID-upload-legal-text"></div>
											</div>
										</div>
									</div>
									<div>
										<label class="">法人身份证国徽面</label>
										<div class="layui-input-block" style="width: 132px;">
											<button type="button" class="layui-btn" id="ID-upload-legal-back-btn">
											  <i class="layui-icon layui-icon-upload"></i> 上传图片
											</button>
											<div class="layui-upload-list">
												<img class="layui-upload-img" id="ID-upload-legal-back-img" style="width: 100%; height: 92px;">
												<div id="ID-upload-legal-back-text"></div>
											</div>
										</div>
									</div>
								</div>
							</div> 
							<div class="layui-form-item">
								<label class="layui-form-label">法人证件类型</label>
								<div class="layui-input-block">
									<select name="legal_cert_type" lay-filter="aihao">
										<option value=""></option>
										<option value="00">身份证</option>
										<option value="01">护照</option>
										<option value="11">港澳台通行证</option>
										<option value="07">其他</option>
									</select>
								</div>
							</div> 
							<div class="layui-form-item">
								<label class="layui-form-label">法人姓名</label>
								<div class="layui-input-block">
									<input type="text" name="legal_info_legal_name" placeholder="请输入法人姓名" autocomplete="off" class="layui-input">
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">证件号码</label>
								<div class="layui-input-block">
									<input type="text" name="legal_info_legal_cert_no" placeholder="请输入证件号码" autocomplete="off" class="layui-input">
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">证件照有效期</label>
								<div class="layui-input-block">
								  <input type="checkbox" value="1" name="legal_cert_validity_type" title="长期">
								</div>
							</div>
							<div class="layui-form-item">
								<div class="layui-inline search_inline">
									<label class="layui-form-label">日期范围：</label>
									<div class="layui-input-inline" style="width: 200px;">
										<input class="layui-input" id="idcard_date" placeholder="日期范围" autocomplete="off">
										<input class="layui-input" type="text" id="idcard_startdate" name="idcard_startdate"
											placeholder="" autocomplete="off" style="display: none;">
										<input class="layui-input" type="text" id="idcard_enddate" name="idcard_enddate"
											placeholder="" autocomplete="off" style="display: none;">
									</div>
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">商户简称</label>
								<div class="layui-input-block">
									<input type="text" name="short_name" placeholder="请输入商户简称" autocomplete="off" class="layui-input">
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">联系人邮箱</label>
								<div class="layui-input-block">
									<input type="text" name="contact_email" placeholder="请输入联系人邮箱" autocomplete="off" class="layui-input">
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">客服电话</label>
								<div class="layui-input-block">
									<input type="text" name="service_phone" placeholder="请输入客服电话" autocomplete="off" class="layui-input">
								</div>
							</div>
							<div id="merchant_acct" class="layui-form-item">
								<label class="layui-form-label">开户许可证</label>
								<div class="layui-input-block" style="width: 132px;">
									<button type="button" class="layui-btn" id="ID-upload-acct-btn">
									  <i class="layui-icon layui-icon-upload"></i> 上传图片
									</button>
									<div class="layui-upload-list">
										<img class="layui-upload-img" id="ID-upload-acct-img" style="width: 100%; height: 92px;">
										<div id="ID-upload-acct-text"></div>
									</div>
								</div>
							</div> 
							<div class="layui-form-item">
								<label class="layui-form-label">银行卡绑定</label>
								<div style="display: flex;">
									<div style="margin-right: 60px;">
										<label class="">银行卡正面</label>
										<div class="layui-input-block" style="width: 132px;">
											<button type="button" class="layui-btn" id="ID-upload-cardface-btn">
											  <i class="layui-icon layui-icon-upload"></i> 上传图片
											</button>
											<div class="layui-upload-list">
												<img class="layui-upload-img" id="ID-upload-cardfront-img" style="width: 100%; height: 92px;">
												<div id="ID-upload-cardface-text"></div>
											</div>
										</div>
									</div>
									<div>
										<label class="">银行卡反面</label>
										<div class="layui-input-block" style="width: 132px;">
											<button type="button" class="layui-btn" id="ID-upload-cardback-btn">
											  <i class="layui-icon layui-icon-upload"></i> 上传图片
											</button>
											<div class="layui-upload-list">
												<img class="layui-upload-img" id="ID-upload-cardback-img" style="width: 100%; height: 92px;">
												<div id="ID-upload-cardback-text"></div>
											</div>
										</div>
									</div>
								</div>
							</div>
							<div class="layui-form-item">
								 <label class="layui-form-label">银行账户类型</label>
								 <div class="layui-input-block">
									<select name="card_cert_type" lay-filter="card_cert_type">
										<option value=""></option>
										<option value="0">对公</option>
										<option value="1">对私法人</option>
									</select>
								 </div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">银行账户名称</label>
								<div class="layui-input-block">
									<input type="text" name="contact_card_name" placeholder="请输入银行账户名称" autocomplete="off" class="layui-input" disabled>
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">银行账户号</label>
								<div class="layui-input-block">
									<input type="text" name="contact_card_no" placeholder="请输入银行账户号" autocomplete="off" class="layui-input">
								</div>
							</div>
							<div id="branch">
								<div class="layui-form-item">
									<label class="layui-form-label">联行号</label>
									<div class="layui-input-block">
										<input type="text" name="branch_code" placeholder="请输入联行号" autocomplete="off" class="layui-input">
									</div>
								</div>
								<div class="layui-form-item">
									<label class="layui-form-label">支行名称</label>
									<div class="layui-input-block">
										<input type="text" name="branch_name" placeholder="请输入支行名称" autocomplete="off" class="layui-input">
									</div>
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">银行开户地区</label>
								<div class="layui-input-block">
								    <div class="layui-input-inline addr_inline">
								        <select name="card_prov_province" id="card_prov_province" lay-filter="card_prov_province" lay-verify="required">
								             <!-- <option value="">请选择省</option> -->
								        </select>
								    </div>
								    <div class="layui-input-inline addr_inline">
								        <select name="card_prov_city" id="card_prov_city" lay-filter="card_prov_city" lay-verify="required">
								            <!-- <option value="">请选择市</option> -->
								        </select>
								    </div>
								 <!--   <div class="layui-input-inline addr_inline" style="margin-right: 0;">
								        <select name="card_prov_area" id="card_prov_area" lay-filter="card_prov_area">
								        </select>
								    </div> -->
								</div>
							</div>
							<div class="layui-form-item">
								 <label class="layui-form-label">银行名称</label>
								 <div class="layui-input-block">
									<select name="bank_code" lay-filter="aihao" lay-verify="required">
										<option value=""></option>
										<option value="01020000">中国工商银行</option>
										<option value="01030000">中国农业银行</option>
										<option value="01050000">中国建设银行</option>
										<option value="01040000">中国银行</option>
										<option value="03010000">交通银行</option>
										<option value="04030000">中国邮政储蓄银行</option>
										<option value="03020000">中信银行</option>
										<option value="03080000">招商银行</option>
										<option value="03134402">平安银行</option>
										<option value="03040000">华夏银行</option>
										<option value="03090000">兴业银行</option>
										<option value="03030000">中国光大银行</option>
										<option value="03050000">中国民生银行</option>
										<option value="03100000">上海浦东发展银行</option>
										<option value="03060000">广发银行</option>
										<option value="03070000">深圳发展银行</option>
										<option value="03130011">北京银行</option>
										<option value="03130031">上海银行</option>
										<option value="03133201">南京银行</option>
										<option value="03133301">杭州银行</option>
										<option value="03133302">宁波银行</option>
									</select>
								 </div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">卡绑定手机号</label>
								<div class="layui-input-block">
									<input type="text" name="card_mp" placeholder="请输入卡绑定手机号" autocomplete="off" class="layui-input">
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">手机号码：</label>
								<div class="layui-input-block">
									<input type="text" name="mobile" lay-verify="required" placeholder="请输入手机号码"
										autocomplete="off" class="layui-input">
								</div>
							</div>

							<div class="layui-form-item">
								<label class="layui-form-label">紧急电话：</label>
								<div class="layui-input-block">
									<input type="text" name="phone" lay-verify="required" placeholder="请输入紧急电话"
										autocomplete="off" class="layui-input">
								</div>
							</div>

							
							<!-- <div class="layui-form-item">
								<label class="layui-form-label">详细地址：</label>
								<div class="layui-input-block">
									<input type="text" name="address" placeholder="请输入详细地址" autocomplete="off"
										class="layui-input">
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">简介：</label>
								<div class="layui-input-block">
									<input type="text" name="explain" placeholder="请输入简介" autocomplete="off"
										class="layui-input">
								</div>
							</div> -->
							<div class="layui-form-item">
								<label class="layui-form-label">备注：</label>
								<div class="layui-input-block">
									<input type="text" name="remark" placeholder="请输入备注" autocomplete="off"
										class="layui-input">
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">原因：</label>
								<div class="layui-input-block">
									<input type="text" name="cause" placeholder="请输入原因" autocomplete="off"
										class="layui-input">
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">申请人：</label>
								<div class="layui-input-block">
									<input type="text" name="add_by" placeholder="请输入申请人" autocomplete="off"
										class="layui-input">
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">申请时间：</label>
								<div class="layui-input-block">
									<input type="text" name="addtime" placeholder="申请时间" autocomplete="off"
										class="layui-input">
								</div>
							</div>
							
							<div class="layui-form-item">
								<label class="layui-form-label">门头照</label>
								<div class="layui-input-block">
									<button type="button" class="layui-btn layui-btn-normal"
										onclick="choose(2)">上传文件</button>
									<blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
										<ul class="show_img_ul" id="shop_front_pic"></ul>
									</blockquote>
								</div>
							</div>
							<div class="layui-form-item">
								<label class="layui-form-label">店内照</label>
								<div class="layui-input-block">

									<button type="button" class="layui-btn layui-btn-normal"
										onclick="choose(4)">上传图片</button>
									<blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
										<ul class="show_img_ul" id="shop_ina_pic"></ul>
									</blockquote>
								</div>
							</div>
							
							<div class="layui-form-item">
								<label class="layui-form-label">收银台</label>
								<div class="layui-input-block">
									<button type="button" class="layui-btn layui-btn-normal"
										onclick="choose(5)">上传图片</button>
									<blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
										<ul class="show_img_ul" id="shop_cashier_pic"></ul>
									</blockquote>
								</div>
							</div>



							

							<!-- 		<div class="layui-form-item">
								<label class = "layui-form-label">评星等级：</label>
								<div id = "score"></div>
							</div> -->

							<!--<div class="layui-form-item">
								<label class="layui-form-label">是否推荐：</label>
								<div class="layui-input-block">
									<input type="checkbox" name="status" lay-skin="switch" lay-text="推荐|不推荐">
								</div>
							</div>
							-->
							<!-- 		<div class="layui-form-item">
								<label class="layui-form-label">服务类型：</label>
								<div class="layui-input-block service_type"></div>
							</div> -->

						</div>
					</div>

					<div class="layui-form-item layui-layout-admin">
						<div class="layui-input-block">
							<div class="layui-footer" style="left: 0;">
								<button class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
							</div>
						</div>
					</div>
				</form>
			</div>
		</div>
		<script type="text/html" id="demo_category">
			<!-- // 店铺分类 -->
			<select name="cate_id" lay-filter="aihao" lay-verify="required">
				<option value=""></option>
				{{# layui.each(d.prolist, function(index, item){ }}
					<option value="{{item.id}}">{{item.name}}</option>
					{{# }); 
				}}
			</select>
		</script>
		<script src="https://unpkg.com/layui@2.6.8/dist/layui.js"></script>
		<!-- <script src="../../../../layuiadmin/layui/layui.js"></script> -->
		<script src="../../../../js/jquery.min.js"></script>
		<script src="../../../../js/jquery.jqprint-0.3.js"></script>
		<script src="../../../../js/common.js"></script>
		<script src="https://webapi.amap.com/maps?v=1.4.15&key=2d30eff9da600d78fba843b033c4eecd"></script>
		<script>
			var positions; //获取接口的坐标
			var coordArr; //把接口的坐标转成数组
			var numArr; //把数组中的坐标转换成数字
			var marker; // 定义全局变量保存标记点对象
			var shopStation; //获取到店铺信息
			var setPosition; //修改位置的信息


			//用来显示地图的函数
			function showMap() {
				console.log("接口坐标", numArr);
				// 初始化地图对象
				var map = new AMap.Map('map-container', {
					zoom: 12,
					center: numArr
				});
				// 创建标记并添加到地图上
				var marker = new AMap.Marker({
					position: numArr,
					map: map,
					draggable: true,
					icon: new AMap.Icon({
						size: new AMap.Size(35, 35),
						image: 'https://webapi.amap.com/theme/v1.3/markers/n/mark_r.png',
						offset: new AMap.Pixel(-12, -24)
					}),
					cursor: 'move'
				});
				// 显示标记信息窗口
				showInfoWindow(marker, map, true); //调用弹出信息窗口函数
				// 监听标记的拖动事件
				marker.on('dragend', function(event) {
					// 当标记结束拖动后，记录新的坐标信息
					console.log('拖动后的坐标：' + event.lnglat.getLng() + ',' + event.lnglat.getLat());
					setPosition = event.lnglat.getLng() + ',' + event.lnglat.getLat()
					// 在标记旁边显示店铺信息和坐标信息
					showInfoWindow(marker, map, false); //调用弹出信息窗口函数
				});
				map.on('click',mapClick);
				    
				function mapClick(e){
					// $("#lon").val(e.lnglat.getLat())
					// $("#lat").val(e.lnglat.getLng())
					setPosition = e.lnglat.getLng() + ',' + e.lnglat.getLat()
					showInfoWindow(marker, map, true); //调用弹出信息窗口函数
					if(!marker){
						marker = new AMap.Marker();
						map.add(marker);
					}
					marker.setPosition(e.lnglat);
					map.setFitView(marker);
					shopStation=''
					// console.log(setPosition,'55555555555')
					// console.log("lon:"+e.lnglat.getLat()+"，lat:"+e.lnglat.getLng())
					// console.log(e)
					return;
					 // 使用经纬度获取位置信息的接口（示例：使用高德地图的逆地址解析API）
					var url="https://restapi.amap.com/v3/geocode/regeo?output=json&location="+e.lnglat.getLng() + "," + e.lnglat.getLat() + "&key=2d30eff9da600d78fba843b033c4eecd&radius=1000&extensions=all"
					// 发送 GET 请求获取位置信息
					layui.$.ajax({
						url: url,
						method: "GET",
						success: function (response) {
							if (response.status === "1") {
								var address = response.regeocode.formatted_address;
								layui.$("#result").text("当前位置信息：" + address);
							} else {
								layer.msg("获取位置信息失败");
							}
						},
						error: function (xhr, status, error) {
							layer.msg("发生错误：" + error);
						}
					});
				
				}
			}

			function showInfoWindow(marker, map, isOpen) {
				// 在标记旁边显示店铺信息和坐标信息
				var setLnglat = marker.getPosition().getLng() + ',' + marker.getPosition().getLat();
				var content = '<div class="infoWindow" >' +
					'<p>店铺信息：' + shopStation + '</p>' +
					'<p>坐标信息：' + setLnglat + '</p>' +
					'</div>';
				var infoWindow = new AMap.InfoWindow({
					offset: new AMap.Pixel(0, -30),
					content: content,
					closeButton: false //关闭小叉号
				});
				if (isOpen) {
					// 是否默认打开信息窗口
					infoWindow.open(map, marker.getPosition());
				} else {
					infoWindow.open(map, marker.getPosition());
				}
			}
			
			



			var _data = {
				id: getParam('id'),
			}
			
			
			layui.config({
				base: '../../../../layuiadmin/' //静态资源所在路径
			}).extend({
				index: 'lib/index' //主入口模块
			}).use(['index', 'form', 'laytpl', 'laydate', 'layedit', 'rate', 'upload'], function() {
				var $ = layui.$,
					admin = layui.admin,
					laytpl = layui.laytpl,
					laydate = layui.laydate,
					upload = layui.upload,
					form = layui.form;
				var rate = layui.rate;
				var img_arr3 = [],
					img_arr1 = [],
					img_arr10 = [],
					img_arr2 = []
				img_arr4 = []
				img_arr5 = []
				//渲染
				var ins1 = rate.render({
					elem: '#score', //绑定元素
					half: true,
					value: _data.score,
					choose: function(value) {
						_data.score = value;
					}
				});
				
				

				sex_show('radio');

				service_type_show('checkbox');
				var lice_index=0
				initdata();
				function initdata() {
					$.get(server.sys_shop_sub_detail, _data, function(res, status) {
						if (status == 'success') {
							if (res.code == 0) {
								console.log(res)
								var data = res.shop_sub
								// 获取 positions 坐标的数据
								if(res.shop_sub.data.positions){
									positions = res.shop_sub.data.positions;
									setPosition=res.shop_sub.data.positions
									coordArr = positions.split(",");
									numArr = [parseFloat(coordArr[0]), parseFloat(coordArr[1])];
								}else{
									numArr = ['113.665794','34.709496'];
								}
								shopStation = res.shop_sub.data.shop_name;
								// _data.shop_front_pic = img_arr2.join(',');
								// _data.shop_ina_pic = img_arr4.join(',');
								// _data.license_pic = img_arr1.join(',');
								getStation(data.data)
								$('#ID-upload-headimg-img').attr('src',data.data.logo_pic)
								if(data.data.sign_pic){
									$('#ID-upload-sign-img').attr('src',data.data.sign_pic)
								}
								data.data.shop_front_pic ? createli(data.data.shop_front_pic, 'shop_front_pic','2') : ''
								data.data.shop_ina_pic ? createli(data.data.shop_ina_pic, 'shop_ina_pic', '4') : ''
								// data.data.shop_cashier_pic ? createli(data.data.shop_cashier_pic, 'shop_cashier_pic', '5') : ''
								data.data.license_pic ? createli(data.data.license_pic, 'license_pic', '1') : ''
								// v-html(red.shop_sub.data.img)
				
								if (numArr != undefined) {
									showMap()
								}
				
								var data = res.shop_sub
								form.val("test_detail", data.data);
								form.render();
							} else {
								layer.msg(res.msg);
							}
						} else {
							layer.msg('服务器连接错误');
						}
					});
				}
				var obj={}
				var allData={}
				var AllDatas={}  // 总数据
				function getStation(all_data){
					// console.log(all_data,'all_data')
					AllDatas=all_data
					if(all_data.billdata){
						let data=JSON.parse(all_data.billdata) 
						allData=data
						obj={
							prov_name:data.prov_name,
							area_name:data.area_name,
							district_name:data.district_name,
							req_seq_id: "",
							req_date: "",
							upper_huifu_id: "",  // 渠道商汇付id
							receipt_name: "",  // 小票名称	，公司类型为0(个人商户)时非必填，其他类型均必填
							mer_en_name: "", // 商户英文名称	公司类型为0(个人商户)时无需填写，其他类型均必填 示例值：HUIFU PAY
							// "mcc": "5399",  // 所属行业 公司类型为0(个人商户)时无需填写，其他类型均必填
							busi_type: "1", //  经营类型
							mer_url: "", // 商户主页URL
							mer_icp: "", // 商户ICP备案编号
							open_licence_no: "", // 	开户许可证核准号
							login_name: "", // 管理员账号	
							sms_send_flag: "", // 是否通知商户标识	
							settle_config: {
								settle_cycle: "T1",  // 	 结算周期 T1 D1，
								fixed_ratio: "",  // 节假日结算手续费率%
								settle_pattern: "",
								is_priority_receipt: "",
								settle_time: "",
								min_amt: "",
								remained_amt: "",
								settle_abstract: "",
								out_settle_flag: "",
								out_settle_huifuid: "",
								out_settle_acct_type: "",
								settle_batch_no: ""
							},
						}
						// $("input[name=types]").val(data.type);
						// if(data.type=='1'){
							$("input:radio[name=types][value="+ data.type +"]").attr("checked", "true");
							layui.form.render('radio');
							// console.log($("input[name=types]").val(),'ppppppppppp')
						// }
						console.log(data.type,'data.type5')
						if(data.type=='1'){
							$('#positiontext').text('门店位置')
							$('#merchant').css('display','none')
							$('#merchant_acct').css('display','none')
							$('#person').css('display','block')  
						}else{
							$('#positiontext').text('商户经营地区')
							$('#merchant').css('display','block')
							$('#merchant_acct').css('display','inline-flex')
							$('#person').css('display','none') 
							
							$('select[name=legal_cert_type]').val(data.legal_info.legal_cert_type)       // 法人证件类型
							$('input[name=legal_info_legal_name]').val(data.legal_info.legal_name)       // 法人姓名
							$('input[name=legal_info_legal_cert_no]').val(data.legal_info.legal_cert_no)       // 法人证件号码
							$("input[name=legal_cert_validity_type]").val(data.legal_info.legal_cert_validity_type);   // 证件照有效期
							_data.legal_identification_address=data.legal_info.legal_identification_address
							$("#idcard_startdate").val(data.legal_info.legal_cert_begin_date);
							$("#idcard_enddate").val(data.legal_info.legal_cert_end_date);	
							$("#idcard_date").val(data.legal_info.legal_cert_begin_date+' - '+data.legal_info.legal_cert_end_date)
							$('#ID-upload-demo-img').attr('src',data.file_info.license_pic_file)  // 营业执照
						}
						$("input[name=reg_name]").val(data.reg_name);
						$("input[name=license_code]").val(data.license_code);   // 营业执照编号
						if(data.license_validity_type=='1'){
							$("#license_validity_type").attr('checked','true');   // 营业证照有效期
							$("#lice_date").val(data.license_begin_date+' - 长期')
							 // form.render('checkbox');
						}
						$("#startdate").val(data.license_begin_date);
						$("#enddate").val(data.license_end_date);	
						// $("#lice_date").val(data.license_begin_date+' - '+data.license_end_date)
						$("select[name=ent_type]").val(data.ent_type);   // 公司类型
						$("select[name=province_code]").val(data.reg_prov_id);   // 公司类型 商户注册地址
						$("textarea[name=reg_detail]").val(data.reg_detail);        // 注册详细地址
						$("input[name=detail_addr]").val(data.detail_addr);        // 经营详细地址
						$('#ID-upload-legal-img').attr('src',data.file_info.legal_cert_front_pic_file)       // 法人身份证人像面
						$('#ID-upload-legal-back-img').attr('src',data.file_info.legal_cert_back_pic_file)       // 法人身份证国徽面
						
						$('#ID-upload-idcard-back-img').attr('src',data.file_info.identification_back_pic_file)
						$('#ID-upload-idcardfront-img').attr('src',data.file_info.identification_front_pic_file)
						$('input[name=contact_cert_no]').val(data.contact_info.contact_cert_no)       // 证件号码
						$("input[name=cert_validity_type]").val(data.card_info.cert_validity_type);   // 证件照有效期
						$("#card_start").val(data.card_info.cert_begin_date);
						$("#card_end").val(data.card_info.cert_end_date);	
						
						$("input[name=remark]").val(all_data.remark);   // 备注
						$("input[name=short_name]").val(data.short_name);  // 商户简称
						$("input[name=service_phone]").val(data.service_phone);  // 客服电话
						$("input[name=contact_name]").val(data.contact_info.contact_name);  // 联系人姓名
						$("input[name=contact_mobile_no]").val(data.contact_info.contact_mobile_no);  // 手机号
						$("input[name=contact_email]").val(data.contact_info.contact_email);  // 电子邮箱
						if(data.file_info.reg_acct_pic_file){
							$('#ID-upload-acct-img').attr('src',data.file_info.reg_acct_pic_file)       // 开户许可证
						}
						$('#ID-upload-cardfront-img').attr('src',data.file_info.settle_card_front_pic_file)       // 银行卡正面
						$('#ID-upload-cardback-img').attr('src',data.file_info.settle_card_back_pic_file)       // 银行卡反面
						$('select[name=card_cert_type]').val(data.card_info.card_type)       // 银行账户类型
					
						if(data.card_info.card_type=='0'){
							$('#branch').css('display','block')
						}else{
							$('#branch').css('display','none')
						}
						$("input[name=contact_card_name]").val(data.card_info.card_name);  // 银行账户名称
						$("input[name=contact_card_no]").val(data.card_info.card_no);  // 银行账户名称
						$("input[name=branch_code]").val(data.card_info.branch_code);  // 联行号
						$("input[name=branch_name]").val(data.card_info.branch_name);  // 支行名称
						$("input[name=reg_detail]").val(data.reg_detail);  // 注册详细地址
						$('select[name=bank_code]').val(data.card_info.bank_code)       // 银行名称
						$("input[name=card_mp]").val(data.card_info.mp);  // 卡绑定手机号
						$("input[name=mobile]").val(data.card_info.mp);  // 手机号码
						$("input[name=phone]").val(data.card_info.mp);  // 紧急电话
						$('#ID-upload-header-img').attr('src',data.file_info.store_header_pic_file)       // 店铺门头照
						$('#ID-upload-desk-img').attr('src',data.file_info.store_cashier_desk_pic_file)       // 店铺收银台
						// $('#ID-upload-indoor-img').attr('src',data.file_info.store_indoor_pic_file)    // 店铺内景照
						data.file_info.store_cashier_desk_pic_file ? createli(data.file_info.store_cashier_desk_pic_file, 'shop_cashier_pic', '5') : ''			
					}
					// $('#ID-upload-acct-img').attr('src',data.file_info.reg_acct_pic_file)       // 法人身份证人像面
				}
				laydate.render({
				    elem: '#test-range' ,//开始时间和结束时间所在 input 框的父选择器
				    //设置开始日期、日期日期的 input 选择器
					type:'date',
				    range: ['#startDate', '#endDate']//数组格式为 layui 2.6.6 开始新增
				});
				//日期范围
				laydate.render({
				    elem: '#idcard_date',
					type:'date',
				    //设置开始日期、日期日期的 input 选择器
				    //数组格式为 2.6.6 开始新增，之前版本直接配置 true 或任意分割字符即可
				    range: true
				});
				getCat()
				var prolist=[]; // 分类
				function getCat(){
					$.get(server.product_category_query, function(res, status) {
						if (status == 'success') {
							if (res.code == 0) {
								if(res.product_category&&res.product_category.data){
									prolist=res.product_category.data
								}
								let datas = {
									prolist: prolist
								};
								var getTpl = demo_category.innerHTML,
								view = document.getElementById('category');
								laytpl(getTpl).render(datas, function(html){
									view.innerHTML = html;
								});
								// console.log(AllDatas,'AllDatas1111')
								record_type_show('option');
								if(AllDatas&&AllDatas.catid){
									$('select[name=cate_id]').val(AllDatas.catid) // 商品分类
								}
								
				
							} else {
								layer.msg(res.msg);
							}
						} else {
							layer.msg('服务器连接错误');
						}
					});
				}
				var areaList;
				setTimeout(()=>{
					$.getJSON('area.json', function (data) {
						areaList=data
						// console.log(areaList,'areaList555')
						var list = "";
						var list = "<option value=''>请选择省</option>";
						for (var i in areaList) {
							list += "<option value='" + areaList[i].value + "'>" + areaList[i].text + "</option>";
						}
						// $('#province').html(list)  // 商户注册地址
						$('#prov_province').html(list)  // 商户经营地区
						$('#card_prov_province').html(list)  // 银行开户地区
						// 商户经营地区 赋值
						$("#prov_province").val(allData.prov_id);   // 公司类型 商户注册地址-省
						form.render('select', 'prov_province_code');
						getprovCityList('edit')  // 市
						getprovdistrictList('edit')  // 区
						
						// 银行开户地区 赋值
						$("#card_prov_province").val(allData.card_info.prov_id);   // 公司类型 商户注册地址-省
						form.render('select', 'card_prov_province');
						getcardProList('edit')  // 市
						// getprovdistrictList('edit')  // 区
					})
					var prov_citylist;
					// select 商户经营地区-省 事件
					form.on('select(prov_province)', function(data){
					    var elem = data.elem; // 获得 select 原始 DOM 对象
					    var value = data.value; // 获得被选中的值
					    var othis = data.othis; // 获得 select 元素被替换后的 jQuery 对象 
					    getprovCityList()
					});
					var prov_districtlist;
					// select 商户注册地址-市 事件
					form.on('select(prov_city)', function(data){
					    var elem = data.elem; // 获得 select 原始 DOM 对象
					    var value = data.value; // 获得被选中的值
					    var othis = data.othis; // 获得 select 元素被替换后的 jQuery 对象
						getprovdistrictList()  // 区
						
					    // layer.msg(this.innerHTML + ' 的 value: '+ value); // this 为当前选中 <option> 元素对象
					});
					
					function getprovCityList(type){
						let p_selectIndex = $('select[name=prov_province_code]').prop('selectedIndex');
						if(p_selectIndex>0){
							let p_index=p_selectIndex-1
							obj.prov_name=areaList[p_index].text
							prov_citylist=areaList[p_index].children
							var list = "";
							var list = "<option value=''>请选择省</option>";
							for (var i in prov_citylist) {
								list += "<option value='" + prov_citylist[i].value + "'>" + prov_citylist[i].text + "</option>";
							}
							$('#prov_city').html(list)
						}
						
						record_type_show('option');
						if(type=='edit'){
							$("#prov_city").val(allData.area_id);   // 公司类型 商户注册地址
							form.render('select', 'prov_province_code');
						}
					}
					function getprovdistrictList(type){
					 	let p_selectIndex = $('select[name=prov_city_code]').prop('selectedIndex');
					 	if(p_selectIndex>0){
					 		let p_index=p_selectIndex-1
							obj.area_name=prov_citylist[p_index].text
					 		prov_districtlist=prov_citylist[p_index].children
					 		var list = "";
					 		var list = "<option value=''>请选择省</option>";
					 		for (var i in prov_districtlist) {
					 			list += "<option value='" + prov_districtlist[i].value + "'>" + prov_districtlist[i].text + "</option>";
					 		}
					 		$('#prov_area').html(list)
					 	}
					 	record_type_show('option');
					 	if(type=='edit'){
					 		$("#prov_area").val(allData.district_id);   // 公司类型 商户注册地址
					 		form.render('select', 'prov_area_code');
					 	}
					}
					// 区
					form.on('select(prov_area)', function(data){
					    var elem = data.elem; // 获得 select 原始 DOM 对象
					    var value = data.value; // 获得被选中的值
					    var othis = data.othis; // 获得 select 元素被替换后的 jQuery 对象
						let p_selectIndex = $('select[name=prov_district_code]').prop('selectedIndex');
						if(p_selectIndex>0){
							let p_index=p_selectIndex-1
							obj.district_name=prov_districtlist[p_index].text
						}
					});
					// select 银行开户地区-省 事件
					var card_citylist;
					form.on('select(card_prov_province)', function(data){
					    var elem = data.elem; // 获得 select 原始 DOM 对象
					    var value = data.value; // 获得被选中的值
					    var othis = data.othis; // 获得 select 元素被替换后的 jQuery 对象 
						// $('select[name=bank_code]').val(data.card_info.bank_code)  
						getcardProList()
					    
					    // layer.msg(this.innerHTML + ' 的 value: '+ value); // this 为当前选中 <option> 元素对象
					});
					// select 银行开户地区-市 事件
					var card_districtlist;
					form.on('select(card_prov_city)', function(data){
					    var elem = data.elem; // 获得 select 原始 DOM 对象
					    var value = data.value; // 获得被选中的值
					    var othis = data.othis; // 获得 select 元素被替换后的 jQuery 对象 
						// $('select[name=bank_code]').val(data.card_info.bank_code)  
						// getcardCityList()
					    
					    // layer.msg(this.innerHTML + ' 的 value: '+ value); // this 为当前选中 <option> 元素对象
					});
					function getcardProList(type){
						let d_selectIndex = $('select[name=card_prov_province]').prop('selectedIndex');
						if(d_selectIndex>0){
							let p_index=d_selectIndex-1
							card_citylist=areaList[p_index].children
							var list = "";
							var list = "<option value=''>请选择市</option>";
							for (var i in card_citylist) {
								list += "<option value='" + card_citylist[i].value + "'>" + card_citylist[i].text + "</option>";
							}
							$('#card_prov_city').html(list)
						}
						record_type_show('option');
						if(type=='edit'){
							$("#card_prov_city").val(allData.card_info.area_id);   // 银行开户地区-省 事件
							form.render('select');
						}
					}
					
				},1000)
				
                //店铺图片上传
			    var uploadInst = upload.render({
					elem: '#ID-upload-headimg-btn',
					url: server.upimg, // 此处用的是第三方的 http 请求演示，实际使用时改成您自己的上传接口即可。
					before: function(obj){
					  // 预读本地文件示例，不支持ie8
					  obj.preview(function(index, file, result){
						  console.log(file,'file555')
					  });
					  // element.progress('filter-demo', '0%'); // 进度条复位
					  layer.msg('上传中', {icon: 16, time: 0});
					},
					done: function(res){
						console.log(res,'fileeeeeee')
						if(res.code==0){
							// 上传成功
							$('#ID-upload-headimg-img').attr('src', res.data.src); // 图片链接（base64）
							return layer.msg('上传完成');
						}
					  // 若上传失败
						if(res.code > 0){
							// submitimgdata()
							return layer.msg('上传失败');
						}
						// 上传成功的一些操作
						$('#ID-upload-headimg-text').html(''); // 置空上传失败的状态
					},
					error: function(){
					  // 演示失败状态，并实现重传
					  var demoText = $('#ID-upload-headimg-text');
					  demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
					  demoText.find('.demo-reload').on('click', function(){
						uploadInst.upload();
					  });
					}
			    });
				
				// 法人身份证上传
				var uploadInst = upload.render({
					elem: '#ID-upload-legal-btn',
					url: server.upimg, // 此处用的是第三方的 http 请求演示，实际使用时改成您自己的上传接口即可。
					before: function(obj){
					  // 预读本地文件示例，不支持ie8
					  obj.preview(function(index, file, result){
						$('#ID-upload-legal-img').attr('src', result); // 图片链接（base64）
					  });
					  
					  // element.progress('filter-demo', '0%'); // 进度条复位
					  layer.msg('上传中', {icon: 16, time: 0});
					},
					done: function(res){
						console.log(res,'fileeeeeee')
						if(res.code==0){
							// 上传成功
							submitimgdata(res.file,'legal_cert_front_pic') 
						}
					  // 若上传失败
						if(res.code > 0){
							// submitimgdata()
							return layer.msg('上传失败');
						}
						// 上传成功的一些操作
						// …
						$('#ID-upload-legal-text').html(''); // 置空上传失败的状态
					},
					error: function(){
					  // 演示失败状态，并实现重传
					  var demoText = $('#ID-upload-demo-text');
					  demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
					  demoText.find('.demo-reload').on('click', function(){
						uploadInst.upload();
					  });
					},
					
				});
				// 法人身份证上传
				var uploadInst = upload.render({
					elem: '#ID-upload-legal-back-btn',
					url: server.upimg, // 此处用的是第三方的 http 请求演示，实际使用时改成您自己的上传接口即可。
					before: function(obj){
					  // 预读本地文件示例，不支持ie8
					  obj.preview(function(index, file, result){
						$('#ID-upload-legal-back-img').attr('src', result); // 图片链接（base64）
					  });
					  // element.progress('filter-demo', '0%'); // 进度条复位
					  layer.msg('上传中', {icon: 16, time: 0});
					},
					done: function(res){
						console.log(res,'fileeeeeee')
						if(res.code==0){
							// 上传成功
							submitimgdata(res.file,'legal_cert_back_pic') 
						}
					  // 若上传失败
						if(res.code > 0){
							// submitimgdata()
							return layer.msg('上传失败');
						}
						// 上传成功的一些操作
						// …
						$('#ID-upload-legal-text').html(''); // 置空上传失败的状态
					},
					error: function(){
					  // 演示失败状态，并实现重传
					  var demoText = $('#ID-upload-demo-text');
					  demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
					  demoText.find('.demo-reload').on('click', function(){
						uploadInst.upload();
					  });
					},
				});



				//监听提交
				form.on('submit(demo1)', function(data) {
					// 阻止表单的默认提交行为
					event.preventDefault();
					var data = data.field;
					_data = Object.assign(_data, data);
					_data.shop_front_pic = img_arr2.join(',');
					_data.shop_ina_pic = img_arr4.join(',');
					_data.license_pic = img_arr1.join(',');
					_data.shop_cashier_pic = img_arr5.join(',');
					
					var lock = false;
					_data.positions = setPosition;
					console.log(_data.positions,'_data.positions')
					var input_value1 = $("#value1").val;
					$("#business_img").attr("src", input_value1)
					console.log("看看所有的表单数据", _data);
					var pdata={
						shop_name: _data.reg_name, //店铺名字
						positions: _data.positions, //经纬度
						blicense_area: _data.reg_detail, //经营地址
						address: _data.reg_detail, //详细地址
						scene: '1', //店铺类型 1线上、2线下、3线上线下
						license_pic: _data.license_pic, //营业执照图片
						shop_front_pic: _data.shop_front_pic, //门脸图
						shop_ina_pic: _data.shop_ina_pic, //室内图
						logo_pic: $('#ID-upload-headimg-img').attr('src'), //logo
						btype: '3', //判断是是什么
						name:_data.name,
						sex:1,
						catid:_data.cate_id,
						area:_data.reg_detail,
						area_id:$("select[name=prov_district_code]").val(),
						area_name:obj.district_name,
						content:_data.content  ,// 店铺简介
						stype:_data.ctype,
						id:_data.id,
						mobile:_data.mobile,
						phone:_data.phone,
						// status:_data.status  ,  // 状态
						addtime:_data.addtime,
						add_by:_data.add_by,
						remark:_data.remark,
						explain:_data.content,
						cause:_data.cause,
						sign_pic:$('#ID-upload-sign-img').attr('src')  // 签名
					}
					// 特约商户
					var billdata={ 	
					    mcc:'5399',
						type:'0',
						ent_type:_data.ent_type,
						file_info:{
							license_pic_file:_data.license_pic,  
							license_pic:'',
							reg_acct_pic_file:_data.ent_type=='3'? $('#ID-upload-acct-img').attr('src'):'',
							reg_acct_pic:'',
							legal_cert_front_pic:'',
							legal_cert_back_pic:'',
							legal_cert_front_pic_file:$('#ID-upload-legal-img').attr('src'),
							legal_cert_back_pic_file:$('#ID-upload-legal-back-img').attr('src'),
							settle_card_back_pic:'',
							settle_card_back_pic_file:$('#ID-upload-cardback-img').attr('src'),
							settle_card_front_pic_file:$('#ID-upload-cardfront-img').attr('src'),
							settle_card_front_pic:'',
							identification_front_pic_file:$('#ID-upload-legal-img').attr('src'),
							identification_front_pic:'',
							identification_back_pic_file:$('#ID-upload-legal-back-img').attr('src'),
							identification_back_pic:'',
							store_header_pic: "",
							store_indoor_pic: "",
							store_cashier_desk_pic: "",
							store_header_pic_file:_data.shop_front_pic,
							store_cashier_desk_pic_file:_data.shop_cashier_pic,
							store_indoor_pic_file:_data.shop_ina_pic,
						},
						reg_name:_data.reg_name,
						license_code:_data.license_code,
						license_validity_type:_data.license_validity_type,
						license_type:'NATIONAL_LEGAL',
						license_begin_date:$('#startdate').val(),
						license_end_date:_data.license_type=='1'?'':$('#enddate').val(),
						short_name:_data.short_name,
						service_phone:_data.service_phone,
						contact_info:{
							contact_name:_data.legal_info_legal_name,
							contact_mobile_no:_data.card_mp,
							contact_email:_data.contact_email,
							contact_cert_no:_data.legal_info_legal_cert_no
						},
						reg_addrs:[$("select[name=prov_province_code]").val(),$("select[name=prov_city_code]").val(),$("select[name=prov_district_code]").val()],
						reg_prov_id:$("select[name=prov_province_code]").val(),
						reg_area_id:$("select[name=prov_city_code]").val(),
						reg_district_id:$("select[name=prov_district_code]").val(),
						reg_detail:_data.reg_detail,
						addrs:[$("select[name=prov_province_code]").val(),$("select[name=prov_city_code]").val(),$("select[name=prov_district_code]").val()],
						prov_id:$("select[name=prov_province_code]").val(),
						area_id:$("select[name=prov_city_code]").val(),
						district_id:$("select[name=prov_district_code]").val(),
						...obj,
						detail_addr:_data.detail_addr?_data.detail_addr:'',
						legal_info:{
							legal_cert_type:_data.legal_cert_type,
							legal_name:_data.legal_info_legal_name,
							legal_cert_no:_data.legal_info_legal_cert_no,
							legal_cert_validity_type:$("input[name=legal_cert_validity_type").val(),
							legal_cert_begin_date: $("#idcard_startdate").val(),
							legal_cert_end_date: $("#idcard_enddate").val(),
							legal_mobile_no: _data.card_mp,
							legal_identification_address:_data.legal_identification_address     // 法人证件居住地址
						},
						legal_cert_daterange:[$("#idcard_startdate").val(),$("#idcard_enddate").val()],
						card_info:{
							card_type: "1",  // 结算类型
							prov_id:_data.card_prov_province,
							area_id:_data.card_prov_city,
							cert_validity_type:$("input[name=legal_cert_validity_type").val(),
							cert_begin_date: $("#idcard_startdate").val(),
							cert_end_date:$("#idcard_enddate").val(),
							card_name:_data.contact_card_name,
							card_no:_data.contact_card_no,   // 	结算账号
							branch_code:_data.branch_code,
							branch_name:_data.branch_name,
							bank_code:$('select[name=bank_code]').val(),
							cert_type:"00",  // 持卡人证件类型
							cert_no: _data.legal_info_legal_cert_no,    // 	持卡人证件号码
							mp:_data.card_mp
						},
						card_address:[$("select[name=card_prov_province]").val(),$("select[name=card_prov_city]").val()],
						wx_conf_list:JSON.stringify([{
							"pay_scene":"1",  // 微信支付场景	 待定
							"fee_rate":'0.23'  ,//手续费（%）
							"mcc":'5399',   // 商户经营类目
						}]) ,
						ali_conf_list:JSON.stringify([{
							"pay_scene":"1",  // 微信支付场景	 待定
							"fee_rate":'0.23'  ,//手续费（%）
							"mcc":'5399',   // 商户经营类目
						}])
					}
					if(_data.license_pic==''){
						return layer.msg('请上传营业执照');
					}
					if(_data.reg_name==''){
						return layer.msg('请输入店铺名称');
					}
					if($('#ID-upload-headimg-img').attr('src')==''){
						return layer.msg('请上传店铺头像');
					}
					if( _data.reg_detail==''){
						return layer.msg('请输入店铺具体位置');
					}
					if($('#prov_province').val()==''||$('#prov_city').val()==''||$('#prov_area').val()==''){
						return layer.msg('请选择商户经营地区');
					}
					// 法人信息
					if($('#ID-upload-legal-img').attr('src')==''||$('#ID-upload-legal-img').attr('src')==undefined){
						return layer.msg('请上传法人身份证人像面');
					}
					if($('#ID-upload-legal-back-img').attr('src')==''||$('#ID-upload-legal-back-img').attr('src')==undefined){
						return layer.msg('请上传法人身份证国徽面');
					}
					if(_data.short_name==''){
						return layer.msg('请输入商户简称');
					}
					if(_data.service_phone==''){
						return layer.msg('请输入客服电话');
					}
					if(_data.ent_type=='3'){
						if($('#ID-upload-acct-img').attr('src')==''||$('#ID-upload-acct-img').attr('src')==undefined)
						return layer.msg('请上传开户许可证');
					}
					if($('#ID-upload-cardfront-img').attr('src')==''){
						return layer.msg('请上传银行卡正面');
					}
					if($('#ID-upload-cardback-img').attr('src')==''){
						return layer.msg('请上传银行卡反面');
					}
					if(_data.card_prov_province==''){
						return layer.msg('请选择银行开户地区');
					}
					if($('select[name=bank_code]').val()==''){
						return layer.msg('请选择银行名称');
					}
					if(_data.card_mp==''){
						return layer.msg('请输入卡绑定手机号');
					}
					if(_data.shop_front_pic==''){
						return layer.msg('请上传门头照');
					}
					if(_data.shop_ina_pic==''){
						return layer.msg('请上传店内照');
					}
					if(_data.shop_cashier_pic==''){
						return layer.msg('请上传收银台');
					}
					console.log(billdata,'billdata666')
					pdata.billdata=JSON.stringify(billdata)
					console.log(pdata,'pdata00000')
					// return;
					var lock = false
					layer.confirm('确定要提交数据？', function() {
						if (!lock) {
							lock = true
							loading();
							if (_data.id) {
								submitdata(server.sys_shop_sub_check,pdata);
							}
							// else {
							// 	delete _data.id;
							// 	submitdata(server.master_insert);
							// }
						}
					}, function() {
						layer.msg('取消操作');
					});
					return false;
				});
				// 开户许可证上传
				var uploadInst = upload.render({
					elem: '#ID-upload-acct-btn',
					url: server.upimg, // 此处用的是第三方的 http 请求演示，实际使用时改成您自己的上传接口即可。
					before: function(obj){
					  // 预读本地文件示例，不支持ie8
					  obj.preview(function(index, file, result){
						// $('#ID-upload-acct-img').attr('src', result); // 图片链接（base64）
					  });
					  // element.progress('filter-demo', '0%'); // 进度条复位
					  layer.msg('上传中', {icon: 16, time: 0});
					},
					done: function(res){
						console.log(res,'fileeeeeee')
						if(res.code==0){
							$('#ID-upload-acct-img').attr('src', res.file); // 图片链接（base64）
							return layer.msg('上传成功');
							
							// 上传成功
							// submitimgdata(res.file,'legal_cert_back_pic') 
						}
					  // 若上传失败
						if(res.code > 0){
							// submitimgdata()
							return layer.msg('上传失败');
						}
						// 上传成功的一些操作
						$('#ID-upload-acct-text').html(''); // 置空上传失败的状态
					},
					error: function(){
						// 演示失败状态，并实现重传
						var demoText = $('#ID-upload-demo-text');
						demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
						demoText.find('.demo-reload').on('click', function(){
							uploadInst.upload();
						});
					}
				});
				//银行卡正面单图片上传
				var uploadInst = upload.render({
					elem: '#ID-upload-cardface-btn',
					url: server.upimg, // 此处用的是第三方的 http 请求演示，实际使用时改成您自己的上传接口即可。
					before: function(obj){
					  // 预读本地文件示例，不支持ie8
					  obj.preview(function(index, file, result){
					 // 图片链接（base64）
					  });
					  
					  // element.progress('filter-demo', '0%'); // 进度条复位
					  layer.msg('上传中', {icon: 16, time: 0});
					},
					done: function(res){
						console.log(res,'fileeeeeee')
						if(res.code==0){
							// 上传成功
							$('#ID-upload-cardfront-img').attr('src', res.file);
							submitimgdata(res.file,'settle_card_front_pic')  // 营业执照
						}
					  // 若上传失败
						if(res.code > 0){
							// submitimgdata()
							return layer.msg('上传失败');
						}
						// 上传成功的一些操作
						// …
						$('#ID-upload-demo-text').html(''); // 置空上传失败的状态
					},
					error: function(){
					  // 演示失败状态，并实现重传
					  var demoText = $('#ID-upload-demo-text');
					  demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
					  demoText.find('.demo-reload').on('click', function(){
						uploadInst.upload();
					  });
					},
				});
				//银行卡背面单图片上传
				var uploadInst = upload.render({
					elem: '#ID-upload-cardback-btn',
					url: server.upimg, // 此处用的是第三方的 http 请求演示，实际使用时改成您自己的上传接口即可。
					before: function(obj){
					  // 预读本地文件示例，不支持ie8
					  obj.preview(function(index, file, result){
						// 图片链接（base64）
					  });
					  // element.progress('filter-demo', '0%'); // 进度条复位
					  layer.msg('上传中', {icon: 16, time: 0});
					},
					done: function(res){
						console.log(res,'fileeeeeee')
						if(res.code==0){
							// 上传成功
							$('#ID-upload-cardback-img').attr('src', res.file); 
							return layer.msg('上传成功');
						}
					  // 若上传失败
						if(res.code > 0){
							// submitimgdata()
							return layer.msg('上传失败');
						}
						// 上传成功的一些操作
						// …
						$('#ID-upload-demo-text').html(''); // 置空上传失败的状态
					},
					error: function(){
					  // 演示失败状态，并实现重传
					  var demoText = $('#ID-upload-demo-text');
					  demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
					  demoText.find('.demo-reload').on('click', function(){
						uploadInst.upload();
					  });
					}
				});

				function submitdata(_url,pdata) {
					$.post(_url, pdata, function(res, status) {
						console.log("看看提交的数据", _url, pdata);
						if (status == 'success') {
							if (res.code == 0) {
								console.log("修改成功后的", res);
								layer.alert('操作成功', function() {
									parent.layer.closeAll();
									parent.layui.table.reload('test-table-operate');
								});
							} else {
								layer.msg(res.msg);
							}
							closeloading();
						} else {
							closeloading();
							layer.msg('服务器连接错误');
						}
					});
				};
				
				
				





				window.choose = function(data) {
					layer.open({
						type: 2,
						title: '上传图片',
						shadeClose: false,
						shade: 0.5,
						maxmin: true, //开启最大化最小化按钮
						area: ['700px', '400px'],
						content: '../../model/up_report.html?type=' + data,
						end: function() {},
						success: function() {}
					});
				}
				window.getimg = function(data, type) { //当单击确定data是图片上传服务器后的地址 type是数字类型
					if (data) {
						switch (type) {
							case '1':
								createli(data, 'license_pic', type)
								break;
							case '2':
								createli(data, 'shop_front_pic', type)
								break;
							case '4':
								createli(data, 'shop_ina_pic', type)
								break;
							case '5':
								createli(data, 'shop_cashier_pic', type)
								break;
							default:
								break;
						}
					}
				}
				window.delimg = function(i, type, _self) {
					var _type = String(type)
					var lock = false
					layer.confirm('确定要删除图片？', function(index) {
						if (!lock) {
							lock = true
							switch (_type) {
								case '1':
									img_arr1.splice(i, 1)
									break;
								case '2':
									img_arr2.splice(i, 2)
									break;
								case '4':
									img_arr4.splice(i, 4)
									break;
								case '5':
									img_arr5.splice(i, 5)
									break;
								default:
									break;
							}
							$(_self).parent().remove();
							layer.close(index)
						}
					}, function() {
						layer.msg('取消操作');
					});
				}
				

				function createli(data, dom, type) { //当单击确定data是图片上传服务器后的地址 type是数字类型
					console.log("执行顺序3", data, "+", dom, type);
					console.log(data)
					if(type=='1'){
						// 营业执照
						if(lice_index==0){
							lice_index=lice_index+1
						}else{
							submitimgdata(data,'license')  // 营业执照
						}
					}
					var lihtml = '';
					switch (type) {
						case '1':
							if (data.indexOf(',') == -1) {
								img_arr1.push(data)
								img_arr1.splice(1);
							} else {
								for (var i = 0; i < data.split(',').length; i++) {
									img_arr1.push(data.split(',')[i])
									img_arr1.splice(1);
									console.log(img_arr1,'img_arr155555')
								}
							}
							for (var i = 0; i < img_arr1.length; i++) {
								lihtml += '<li class="show_img_li">' +
									'<img src=' + img_arr1[i] + ' >' +
									'<p onclick="delimg(' + i + ',1,this)">删除</p>' +
									'</li>'
							}
							break;
						case '2':
							if (data.indexOf(',') == -1) {
								img_arr2.push(data)
								img_arr2.splice(1);
							} else {
								for (var i = 0; i < data.split(',').length; i++) {
									img_arr2.push(data.split(',')[i])
									img_arr2.splice(1);
								}
							}
							for (var i = 0; i < img_arr2.length; i++) {
								lihtml += '<li class="show_img_li">' +
									'<img src=' + img_arr2[i] + ' >' +
									'<p onclick="delimg(' + i + ',2,this)">删除</p>' +
									'</li>'
							}
							break;
						case '4':
							if (data.indexOf(',') == -1) {
								img_arr4.push(data)
								img_arr4.splice(1);
							} else {
								for (var i = 0; i < data.split(',').length; i++) {
									img_arr4.push(data.split(',')[i])
									img_arr4.splice(1);
								}
							}
							console.log(img_arr4,'img_arr4[i]555')
							for (var i = 0; i < img_arr4.length; i++) {
								lihtml += '<li class="show_img_li">' +
									'<img src=' + img_arr4[i] + ' >' +
									'<p onclick="delimg(' + i + ',4,this)">删除</p>' +
									'</li>'
							}
							break;
						case '5':
							if (data.indexOf(',') == -1) {
								img_arr5.push(data)
								img_arr5.splice(1);
							} else {
								for (var i = 0; i < data.split(',').length; i++) {
									img_arr5.push(data.split(',')[i])
									img_arr5.splice(1);
								}
							}
							for (var i = 0; i < img_arr5.length; i++) {
								lihtml += '<li class="show_img_li">' +
									'<img src=' + img_arr5[i] + ' >' +
									'<p onclick="delimg(' + i + ',5,this)">删除</p>' +
									'</li>'
							}
							break;
						default:
							break;
					}
					$('#' + dom).html(lihtml);
				}
				
				function submitimgdata(data,type){
					if(type=='license'){
						initbizlicense(data, type)
					} else if (type == 'legal_cert_front_pic') {
						initidcardmsg(data, 0, type);
					}else if (type == 'legal_cert_back_pic') {
						initidcardmsg(data, 1, type);
					}else if (type == 'identification_front_pic') {
						initidcardmsg(data, 0, type);
					}else if (type == 'identification_back_pic') {
						initidcardmsg(data, 1, type);
					} else if (type == 'settle_card_front_pic') {
						initcredential(data, type);
					}
					
				}
				// 银行卡识别
				function initcredential(data, type){
					layer.msg('识别中...');
					let _data={
						url:data
					}
					$.post(server.getcredential, _data,function(res, status) {
						if(status == 'success') {
							console.log(res, 'cdata');
							if(res.code=='0'){
								var ocr = JSON.parse(res.data);
								if (ocr.CardType && ocr.CardType == '贷记卡') {
									return layer.msg('银行卡不能为信用卡');
								}
								if (ocr.BankInfo) {
									// let bank_code = +ocr.BankInfo.replace(/[^0-9]/gi, '');
									let bank_code = ocr.BankInfo.replace(/\D/g, '').toString();
									$('select[name=bank_code]').val(bank_code)
									form.render('select')
								}
								if (ocr.CardNo){
									$("input[name=contact_card_no]").val(ocr.CardNo)
								}
							}
						} else {
							layer.msg('服务器连接错误');
						}
					});
				}
				// 身份证识别
				function initidcardmsg(data, type, pic){
					let _data={
						img: data
					}
					layer.msg('识别中...');
					// console.log('开始识别' + pic + ':' + config.server.getidcardmsg + type + '?img=' + data);
					$.get(server.getidcardmsg+type+'?img='+data, function(res, status) {
						if(status == 'success') {
							if(res.code=='0'){
								console.log(res, 'cdata');
								var cdata = res;
								if (pic == 'legal_cert_front_pic') {
									$('input[name=legal_info_legal_name]').val(cdata.name)
									$("input[name=contact_card_name]").val(cdata.name)
									// self.legal_info.legal_name = cdata.name;
									$('input[name=legal_info_legal_cert_no]').val(cdata.cardid)
									// self.legal_info.legal_cert_no = cdata.cardid;
									$('select[name=legal_cert_type]').val('00')
									// self.legal_info.legal_cert_type = '00';
									_data.legal_identification_address = cdata.address;
									// self.formData.contact_info.contact_cert_no = cdata.cardid;
									// self.formData.card_info.cert_no = cdata.cardid;
									// self.formData.card_info.card_name = self.legal_info.legal_name;
								} else if (pic == 'identification_front_pic') {
									// self.formData.reg_name = cdata.name;
									$("input[name=reg_name]").val(cdata.name)  // 姓名
									$("input[name=contact_cert_no]").val(cdata.cardid)  // 证件号码
								} else if (pic == 'legal_cert_back_pic' || pic == 'identification_back_pic') {
									if (cdata.valid_date) {
										$("#idcard_startdate").val(cdata.valid_date.split('-')[0].replace(/\./g, '-'));
										$("#card_start").val(cdata.valid_date.split('-')[0].replace(/\./g, '-'));
										if (cdata.valid_date.indexOf('长期') == -1) {
											$("input[name=legal_cert_validity_type]").val('0');
											$("input[name=cert_validity_type]").val('0');
											$("#idcard_enddate").val(cdata.valid_date.split('-')[1].replace(/\./g, '-'));
										    $("#card_end").val(cdata.valid_date.split('-')[1].replace(/\./g, '-'));
										    $("#idcard_date").val($("#idcard_startdate").val()+' - '+$("#idcard_enddate").val())
					
										} else {
											$("input[name=legal_cert_validity_type]").val('1');
											$("input[name=legal_cert_validity_type]").attr('checked','true');
											form.render('checkbox');
											$("#idcard_enddate").val('');
											$("#card_end").val('');
											$("#idcard_date").val($("#idcard_startdate").val()+' - '+$("#idcard_enddate").val())
											$("input[name=cert_validity_type]").val('1');
											$("#cert_validity_type").attr('checked','true');
											form.render('checkbox');
										}
								
									}
								}
							}
						} else {
							layer.msg('服务器连接错误');
						}
					});
				}
				// 营业执照识别
				function initbizlicense(data, type){
					let _data={
						url:data
					}
					$.post(server.getbizlicense, _data, function(res, status) {
						if(status == 'success') {
							if(res.code=='0'){
								// 识别成功
								// $("select[name=license_type]").val("NATIONAL_LEGAL");   // 营业执照类型
								let license=JSON.parse(res.data)
								// layer.msg('上传成功');
								if(license.Type.includes('个体')){
									//  个体工商户
									$("select[name=ent_type]").val(5)
								}else{
									// 私营企业
									$("select[name=ent_type]").val(3)
								}
								layui.form.render();
								$("input[name=reg_name]").val(license.Name) 
								$("input[name=license_code]").val(license.RegNum)
								$("#startdate").val(license.Period.split('至')[0].replace("年","-").replace("月","-").replace("日",""))
					
								if(license.Period.indexOf("长期")==-1){
									$("#license_validity_type").attr('checked','false');   // 营业证照有效期
									$("#enddate").val(license.Period.split('至')[1].replace("年","-").replace("月","-").replace("日",""));
									$("#lice_date").val($("#startdate").val()+' - '+$("#enddate").val())
								}else{
									$("#license_validity_type").attr('checked','true');   // 营业证照有效期
									$("#enddate").val('')
									$("#lice_date").val($("#startdate").val()+' - 长期')
								}
								$("input[name=reg_detail]").val(license.Address);        // 注册详细地址
								// $("input[name=detail_addr]").val(license.Address);        // 经营详细地址
								
								var reg = /.+?(省|市|自治区|自治州|县|区)/g; // 省市区的正则
								var addrs = license.Address.match(reg);
								var sheng_code = "";
								var shi_code = "";
								var xian_code = "";
								console.log("省市区:"+addrs);
								if(addrs[0]){
									// self.formData.prov_name = addrs[0];
									obj.prov_name=addrs[0];
									let sheng = addrs[0];
									console.log(areaList,'areaList222')
									for(let p in areaList){
										if(sheng.indexOf(areaList[p].text)>-1){//匹配到省
											console.log("省市区:"+addrs);
											let adata = areaList[p];
											sheng_code = adata.value;
											if(addrs[1]&&adata.children){
												let shi = addrs[1];
												obj.area_name=shi
												for(let s in adata.children){
													if(shi.indexOf(adata.children[s].text)>-1){//匹配到市
														shi_code = adata.children[s].value;
														if(addrs[2]&&adata.children[s].children){
															let xian = addrs[2];
															obj.district_name = xian;
															for(let x in adata.children[s].children){
																if(xian.indexOf(adata.children[s].children[x].text)>-1){//匹配到市
																	var xian_code = adata.children[s].children[x].value;
																	break;
																}
															}
														}
													}
												}
											}
											
										}
									}
								}
								console.log("省市区:"+sheng_code+","+shi_code+","+xian_code);
							}
						} else {
							layer.msg('服务器连接错误');
						}
					});
				}
			});
		</script>
	</body>

</html>